import {PluginCommand} from "../PluginCommand";
import {
  PluginCADToolFunctionType,
  PluginEventType,
  PluginFunctionType
} from "../../../nodeApp/static/lib/crowncad-plugin-sdk-0.0.1";


class InterferenceCheckCommand extends PluginCommand {
  constructor() {
    super();
  }
  //获取实例的顶级节点
  getTopInstance(instance,cb){
    this.query.getTopInstance(instance.id).then(topInstance => {
      cb(topInstance);
    });
  }
  highlightStaticCheckResult(resultParam){
    this.toolQuery.highlightStaticCheckResult(resultParam);
  }
  highlightGapCheckResult(resultParam){
    this.toolQuery.highlightGapCheckResult(resultParam);
  }
  //计算静态干涉检查
  calculateStaticInterferenceCheck(checkParams,cb){
      this.toolQuery.getInterferenceCheckResults(checkParams).then(res => {
        cb(res.data.elements);
      })
  }
  //计算间隙检查
  calculateGapCheck(checkParams,cb){
    this.toolQuery.getGapCheckResults(checkParams).then(res => {
      cb(res.data.elements);
    })
  }
  //计算动态干涉检查
  calculateTransformInterferenceCheck(checkParams,cb){
    this.toolQuery.calculateInterferences(checkParams).then(res => {
      cb(res.data.elements);
    })
  }

  //计算动态干涉检查的XYZ变换模式
  calculateTransformInterferenceXYZTrans(checkParams){
    this.toolQuery.calculateTransByXYZ(checkParams);
  }

  //初始化动态干涉检查状态
  initTransformInterferenceCheck(checkParams){
    this.toolQuery.initTransformInterferenceCheck(checkParams);
  }

  setSelectEnable(params){
    this.toolQuery.setSelectEnable(params);
  }
}

const interferenceCheckCommand = new InterferenceCheckCommand();
export {interferenceCheckCommand};
